﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using BOHVote.BLL;

namespace BOH.DataManagement
{
    public partial class JobRankList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindJobRank();
            }
        }

        public void BindJobRank()
        {
            DataSet dst = OtherClass.getAllJobRank();
            JobRankViewList.DataSource = dst;
            JobRankViewList.DataBind();
        }

        public string getStatus(string status)
        {
            string returnvalue = string.Empty;
            switch (status)
            {
                case "A":
                    returnvalue = "激活";
                    break;
                case "D":
                    returnvalue = "<font color='red'>未激活</font>";
                    break;
                default:
                    break;
            }

            return returnvalue;
        }

        protected void JobRankViewList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            GridViewRow dr = this.JobRankViewList.Rows[e.RowIndex];
            string JID = ((HiddenField)dr.FindControl("hiddeID")).Value;
            OtherClass.DeleteJobRank(JID);

            BindJobRank();
        }
    }
}
